package com.hua.method;

import java.util.Scanner;

public class Calculator {
    public static void main(String[] args) {
//        System.out.println("请输入要计算的表达式:");
        while (true) {
            Scanner scanner = new Scanner(System.in);
            System.out.println("请输入：");


            int a = scanner.nextInt();


            String b = scanner.next();


            int c = scanner.nextInt();



            int result = 0;
            switch (b){
                case "+":
                    result = add(a,c);
                    System.out.println(a+"+"+c+"="+result);
                    break;
                case "-":
                    result = reduce(a,c);
                    System.out.println(a+"-"+c+"="+result);
                    break;
                case "x":
                    result = multiply(a,c);
                    System.out.println(a+"x"+c+"="+result);
                    break;
                case "/":
                    result = divide(a,c);
                    System.out.println(a+"/"+c+"="+result);
                    break;
                default:
                    System.out.println("您输入的符号不对");
            }



        }

        }

    public static int add(int a ,int b){
        return a+b;
    }
    public static int reduce(int a ,int b){
        return a-b;
    }
    public static int multiply(int a ,int b){
        return a*b;
    }
    public static int divide(int a ,int b){
        return a/b;
    }



}
